<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
</body>
</html>
<script>
  function fn () {
    // 获取设备的宽,保存到变量 screen_w
    var screenw = document.body.clientWidth || document.documentElement.clientWidth
    // 设计稿的宽
    var desw = 750
  
    var rate = screenw / desw
    // 320  /     640   = 0.5  * 100 = 50
    document.documentElement.style.fontSize = rate * 100 + 'px'
  }
  fn()
  // js改变手机屏  调用fn执行
  window.addEventListener('resize', fn)
</script>